/*    */ package com.wgcloud;
/*    */ import org.apache.http.client.HttpClient;
import org.apache.http.conn.socket.LayeredConnectionSocketFactory;
import org.apache.http.conn.ssl.NoopHostnameVerifier;
import org.apache.http.conn.ssl.SSLConnectionSocketFactory;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.ssl.SSLContexts;
import org.apache.http.ssl.TrustStrategy;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.http.client.ClientHttpRequestFactory;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.scheduling.TaskScheduler;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.concurrent.ThreadPoolTaskScheduler;
import org.springframework.web.client.RestTemplate;

import javax.net.ssl.HostnameVerifier;
import javax.net.ssl.SSLContext;
import java.security.KeyManagementException;
import java.security.KeyStoreException;
import java.security.NoSuchAlgorithmException;

/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */
/*    */ 
/*    */ @SpringBootApplication
/*    */ @MapperScan({"com.wgcloud.mapper"})
/*    */ @ServletComponentScan({"com.wgcloud.filter"})
///*    */ @ComponentScan(basePackages = {"com.wgcloud"})
/*    */ @EnableCaching
/*    */ @EnableScheduling
/*    */ public class WgcloudServiceApplication {
/*    */   public static void main(String[] args) {
/* 36 */     SpringApplication.run(com.wgcloud.WgcloudServiceApplication.class, args);
/*    */   }
/*    */ 
/*    */   
/*    */   @Bean
/*    */   public RestTemplate restTemplate() {
/* 42 */     HttpComponentsClientHttpRequestFactory requestFactory = null;
/*    */     try {
/* 44 */       requestFactory = generateHttpRequestFactory();
/* 45 */     } catch (NoSuchAlgorithmException e) {
/* 46 */       e.printStackTrace();
/* 47 */     } catch (KeyManagementException e) {
/* 48 */       e.printStackTrace();
/* 49 */     } catch (KeyStoreException e) {
/* 50 */       e.printStackTrace();
/*    */     } 
/*    */     
/* 53 */     requestFactory.setConnectTimeout(20000);
/* 54 */     requestFactory.setReadTimeout(20000);
/* 55 */     return new RestTemplate((ClientHttpRequestFactory)requestFactory);
/*    */   }
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */ 
/*    */   
/*    */   public static HttpComponentsClientHttpRequestFactory generateHttpRequestFactory() throws NoSuchAlgorithmException, KeyManagementException, KeyStoreException {
/* 68 */     TrustStrategy acceptingTrustStrategy = (x509Certificates, authType) -> true;
/* 69 */     SSLContext sslContext = SSLContexts.custom().loadTrustMaterial(null, acceptingTrustStrategy).build();
/* 70 */     SSLConnectionSocketFactory connectionSocketFactory = new SSLConnectionSocketFactory(sslContext, (HostnameVerifier)new NoopHostnameVerifier());
/*    */     
/* 72 */     HttpClientBuilder httpClientBuilder = HttpClients.custom();
/* 73 */     httpClientBuilder.setSSLSocketFactory((LayeredConnectionSocketFactory)connectionSocketFactory);
/* 74 */     CloseableHttpClient httpClient = httpClientBuilder.build();
/* 75 */     HttpComponentsClientHttpRequestFactory factory = new HttpComponentsClientHttpRequestFactory();
/* 76 */     factory.setHttpClient((HttpClient)httpClient);
/* 77 */     return factory;
/*    */   }
/*    */   
/*    */   @Bean
/*    */   public TaskScheduler taskScheduler() {
/* 82 */     ThreadPoolTaskScheduler taskScheduler = new ThreadPoolTaskScheduler();
/* 83 */     taskScheduler.setPoolSize(50);
/* 84 */     return (TaskScheduler)taskScheduler;
/*    */   }
/*    */ }


/* Location:              /Users/zhangyongxin/soft-install/wgcloud/wgcloud-v3.3.5/server/bank/wgcloud-server-release.jar!/BOOT-INF/classes/com/wgcloud/WgcloudServiceApplication.class
 * Java compiler version: 8 (52.0)
 * JD-Core Version:       1.1.3
 */